﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SnakeGame
{
    public class Block
    {
        private MatrixCoordinate[,] body;
        private MatrixCoordinate topLeft;

        public Block(int topLeftX, int topLeftY, int rows, int columns)
        {
            this.body = new MatrixCoordinate[rows, columns];

            for (int row = 0; row < rows; row++)
            {
                for (int column = 0; column < columns; column++)
                {
                    this.body[row, column] = new MatrixCoordinate(topLeftX + row, topLeftY + column);
                }
            }

            this.TopLeft = this.body[0, 0];
        }

        public MatrixCoordinate[,] Body
        {
            get
            {
                return this.body;
            }
        }

        public MatrixCoordinate TopLeft
        {
            get
            {
                return this.topLeft;
            }

            private set
            {
                this.topLeft = value;
            }
        }

        public int Rows
        {
            get
            {
                return this.body.GetLength(0);
            }
        }

        public int Columns
        {
            get
            {
                return this.body.GetLength(1);
            }
        }
    }
}
